<?php

namespace App\Modules\Admin\Http\Controllers;


use App\Http\Controllers\BaseController;
use App\Services\SystemModuleInfoService;
use Illuminate\Http\Request;

class SystemModuleInfoController extends BaseController
{
    public function __construct(SystemModuleInfoService $systemModuleInfoService)
    {
        $this->middleware('check.adminLogin')->except('index');

        $this->systemModuleInfoService = $systemModuleInfoService;
    }

    public function store(Request $request)
    {
        $param = $this->validationParameter([
            'module|模块' => 'require',
            'key|key' => 'require',
            'value|value' => 'require',
        ]);

        $result = $this->systemModuleInfoService->add($param);

        return $this->response->success($result);
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $param = [];
        $result = $this->systemModuleInfoService->update($param, $id);

        return $this->response->success($result);
    }

    public function destroy(Request $request)
    {
        $id = $request->input('id');
        $result = $this->systemModuleInfoService->delete($id);

        return $this->response->success($result);
    }
}
